package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.WmSensitiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * @author 霍森彪
 * @date 2022/7/26 14:26
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {

    @Autowired
    private WmSensitiveService wmSensitiveService;

    /**
     * 敏感词新增
     * @param sensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult sensitiveSave(@RequestBody WmSensitive sensitive){

        return wmSensitiveService.sensitiveSave(sensitive);
    }

    /**
     * 查询敏感词列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public PageResponseResult sensitiveList(@RequestBody SensitiveDto dto){
        return wmSensitiveService.sensitiveList(dto);
    }

    /**
     * 修改敏感词
     * @param sensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive sensitive){
        return wmSensitiveService.updateSensitive(sensitive);
    }

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id){
        return wmSensitiveService.deleteSensitive(id);
    }
}
